<?php 
use_helper('I18N');

$jckBrowserConf = sfConfig::get('app_jck_browser');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <?php include_http_metas() ?>
    <?php include_metas() ?>
    <?php include_title() ?>
    <link rel="shortcut icon" href="/favicon.ico" />
    <?php include_stylesheets() ?>
    <link rel="stylesheet" type="text/css" media="screen" href="<?php echo $jckBrowserConf['css'] ?>" />
    <script type="text/javascript" src="<?php echo sfConfig::get('app_jck_jquery_core') ?>"></script>
    <script type="text/javascript" src="/jckBrowserPlugin/js/jckbrowser.js"></script>
    <?php include_javascripts() ?>

  </head>
  <body>
    <?php if( $sf_user->hasFlash('notice') || $sf_user->hasFlash('error') ): ?>
      <div id="message-flash">
        <?php if( $sf_user->hasFlash('notice')): ?>
          <div class="notice">
            <h1><?php echo __('Information',null,'jckbrowser') ?></h1>
            <?php echo $sf_user->getFlash('notice') ?> 
          </div>
        <?php endif; ?>
        
        <?php if( $sf_user->hasFlash('warning')): ?>
        <div class="warning">
           <h1><?php echo __('Warning',null,'jckbrowser') ?></h1>
            <?php echo $sf_user->getFlash('warning') ?> 
          </div>
        <?php endif; ?>
        
        <?php if( $sf_user->hasFlash('error')): ?>
        <div class="error">
            <h1><?php echo __('Error',null,'jckbrowser') ?></h1>
            <?php echo $sf_user->getFlash('error') ?> 
          </div>
        <?php endif; ?>
        
      </div>
      
    <?php endif; ?>
    
    
    <?php
    if( isset($form) ){
      include_partial('uploadForm', array('form'=>$form, 'profil'=>$profilConfiguration->getName()));
    }
    ?>

    <?php if( $profilConfiguration->allowBrowse()): ?>
    <div id="path-content">
      <ul>
      <?php 
      $children = $dir->getChildren();
      
      foreach( $children as $child) { 
        if( $child->isFile() && $type = $profilConfiguration->allowMimeType($child->getMimeType()) ){
          include_partial($type.'Item', array('profilConfiguration'=>$profilConfiguration, 'child'=>$child));
        }
      }
      ?>
      </ul>
    </div>
    <?php endif; ?>
  </body>
</html>

